﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;
using Server_NhaSach.DataTransferObject;
using Server_NhaSach.DataAccess.LogicLayer;


namespace Server_NhaSach.BusinessLayer
{
    [Serializable]
    public class FormBlo
    {
        #region "Khai báo các biến"
        private FormDAO da;
        private FormDTO _Form;
        private string _error;
        #endregion
        #region "Khai báo các thuộc tính"
        public string Error
        {
            get { return _error; }
        }
        public FormDTO Form
        {
            get { return _Form; }
            set { _Form = value; }
        }
        #endregion
        #region "Khai báo các Method"
        public FormBlo()
        {            
            da = new FormDAO();
        }
        public bool InsertForm(string MaForm, string TenForm)
        {
            _Form = new FormDTO(MaForm,TenForm);
            if (!da.InsertForm(Form))
            {
                _error = da.Error;
                return false;
            }
            return true;
        }
        public bool UpdateForm(string MaForm, string TenForm)
        {
            _Form = new FormDTO(MaForm, TenForm);
            if (!da.UpdateForm(Form))
            {
                _error = da.Error;
                return false;
            }
            return true;
        }
        public bool DeleteForm(string MaForm)
        {
            if (!da.DeleteForm(MaForm))
            {
                _error = da.Error;
                return false;
            }
            return true;
        }
        public DataSet LayDS_Form()
        {
            DataSet ds = new DataSet();
            ds = da.LayDS_Form();
            return ds;
        }
        #endregion 
    }
}